package org.dromara.system.api.services;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.utils.AssertUtils;
import org.dromara.system.api.domain.vo.RemoteClientVo;
import org.dromara.system.api.feign.SystemClientClient;
import org.springframework.stereotype.Service;

/**
 * @author: zhou shuai
 * @date: 2024/10/6 10:52
 * @version: v1
 */
@Slf4j
@Service("sysClientApiService")
@RequiredArgsConstructor
public class SysClientApiService {

    private final SystemClientClient systemClientClient;

    /**
     * 根据客户端id获取客户端详情
     *
     * @author: zhou shuai
     * @date: 2024/10/6 10:53
     * @param: clientId
     * @return: org.dromara.system.api.domain.vo.RemoteClientVo
     */
    public RemoteClientVo queryByClientId(String clientId) {
        R<RemoteClientVo> clientResult = systemClientClient.queryByClientId(clientId);
        AssertUtils.assertTrue(R.isSuccess(clientResult), "获取客户端详情失败");
        return clientResult.getData();
    }

}
